home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2736 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.2 KB

  1. Path: news.bridge.net!news
  2. From: David Byrden <100101.2547@compuserve.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: STL experts, is this a bug?
  5. Date: 19 Jan 1996 10:56:09 GMT
  6. Organization: self-employed
  7. Message-ID: <4dntc9$6fo@news.bridge.net>
  8. NNTP-Posting-Host: ppp-mia1-50.bridge.net
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 1.1N (Windows; I; 16bit)
  13.  
  14.  
  15.  
  16. I'm trying to define an allocator and I have run into a problem.
  17.  
  18. In the HP STL, deque::iterator has a default ctor which initialises
  19. several of its members with the value 0
  20.  
  21.     iterator() : current(0), first(0), last(0), node(0) {}
  22.  
  23. These members have the type deque::pointer, which is a typedef
  24. for the pointer in deque's allocator.
  25.  
  26. An allocator pointer, according to the standard, has exactly the same
  27. semantics as a random access iterator.
  28.  
  29. I can find no place where it says that all random access iterators 
  30. should be constructable from the int value zero, neither in 
  31. documentation from the time of the HP STL, nor the latest draft standard.
  32.  
  33. So, this ctor seems to break the rules. Yet it was written by the 
  34. inventors of STL.
  35.  
  36. Any contributions?
  37.  
  38.  
  39.  
  40.              David Byrden
  41.  
  42.  
  43.  
  44.